﻿<%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation="false" CodeBehind="Category.aspx.cs"
    Inherits="LMSemir.Backstage.Category" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>森马TEE后台管理系统v1.0-分类查询</title>
    <link rel="stylesheet" href="css/reset.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="css/invalid.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="css/jphotogrid.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="css/jphotogrid.ie.css" type="text/css" media="screen" />
</head>
<body>
    <div id="body-wrapper">
        <div id="sidebar">
            <div id="sidebar-wrapper">
                <h1 id="sidebar-title">
                    <a href="#">森马TEE后台管理</a></h1>
                <a href="#">
                    <img id="logo" src="images/logo.png" alt="Simpla Admin logo" /></a>
                <div id="profile-links">
                    您好, <a href="#" title="Edit your profile">
                        <%=this.userName %></a>, 您有 <a href="#messages" rel="modal" title="3 Messages">0条消息未读</a><br />
                    <br />
                    <a href="#" title="View the Site">访问主站</a> | <a href="signin.aspx?op=signout" title="退出系统">
                        退出</a>
                </div>
                <ul id="main-nav">
                    <!-- Accordion Menu -->
                    <li><a href="#" class="nav-top-item no-submenu">控制面板 </a></li>
                    <li><a href="#" class="nav-top-item current">TEE信息管理</a>
                        <ul>
                            <li><a href="admin.aspx">作品管理</a></li>
                            <li><a class="current" href="Category.aspx">分类查询</a></li>
                        </ul>
                    </li>
                    <%--  <li><a href="#" class="nav-top-item">系统设置</a>
                        <ul>
                            <li><a href="#">个人资料</a></li>
                            <li><a href="#">公司信息</a></li>
                        </ul>
                    </li>--%>
                </ul>
            </div>
        </div>
        <div id="main-content">
            <h3>
                TEE作品列表:&nbsp;&nbsp;总计：<span style="color: Red;"><%=this.strTotalCount%></span>部</h3>
            <form id="form1" action="" method="post">
            <div class="content-box">
                <div class="content-box-header">
                    <div style="padding: 10px; width: 940px; float: right;">
                        时间&nbsp;
                        <input type="text" id="startTS" value="<%=this.startTime %>" style="width: 80px;"
                            name="startTime" />
                        至
                        <input type="text" id="endTS" value="<%=this.endTime %>" style="width: 80px;" name="endTime" />
                        &nbsp;&nbsp; 手机
                        <input type="text" value="<%=this.strTMobile %>" name="mobile" id="in_mobile" style="width: 80px" />
                        状态&nbsp;<select id="sl_status" name="sl_status">
                            <option value="0" selected="selected">所有</option>
                            <option value="1">入围</option>
                            <option value="2">最潮</option>
                            <option value="3">获奖</option>
                            <option value="4">未审核</option>
                        </select>&nbsp;&nbsp;分类&nbsp;<select id="sl_category" name="sl_category">
                            <option value="0" selected="selected">所有</option>
                            <option value="1">最热</option>
                            <option value="2">视频</option>
                            <option value="3">原创</option>
                            <option value="4">艺术家</option>
                            <option value="5">名人</option>
                        </select>
                        来源&nbsp;
                        <select id="sl_source" name="sl_source">
                            <option value="0" selected="selected">所有</option>
                            <option value="1">森马</option>
                            <option value="2">土豆</option>
                            <option value="4">手机</option>
                            <option value="3">豆瓣</option>
                        </select>
                        姓名 &nbsp;
                        <input type="text" name="teeName" id="in_author" style="width: 80px;" value="<%=this.strTAuthor %>" />
                        &nbsp;<input type="submit" id="sb_submit_search" value="搜索" />
                        &nbsp;<input type="button" id="btn_export_excel" value="下载" />
                    </div>
                    <div class="clear">
                    </div>
                </div>
                <div class="content-box-content">
                    <div class="tab-content default-tab" id="tab1">
                        <asp:Repeater ID="repTeeList" runat="server">
                            <HeaderTemplate>
                                <table>
                                    <thead>
                                        <tr>
                                            <th>
                                                编号
                                            </th>
                                            <th>
                                                日期
                                            </th>
                                            <th>
                                                姓名
                                            </th>
                                            <th>
                                                手机
                                            </th>
                                            <th>
                                                邮箱
                                            </th>
                                            <th>
                                                地址
                                            </th>
                                            <th style="text-align: center;">
                                                图片
                                            </th>
                                            <th>
                                                审核
                                            </th>
                                            <th>
                                                获奖
                                            </th>
                                            <th>
                                                最潮
                                            </th>
                                            <th>
                                                入围
                                            </th>
                                            <th style="text-align: center;">
                                                票数
                                            </th>
                                            <th>
                                                操作
                                            </th>
                                        </tr>
                                    </thead>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <tbody>
                                    <tr id="row_<%#DataBinder.Eval(Container.DataItem,"tid") %>">
                                        <td width="50">
                                            <%#DataBinder.Eval(Container.DataItem,"tid") %><br />
                                            <input type="checkbox" name="item_check" value=" <%#DataBinder.Eval(Container.DataItem,"tid") %>" />
                                        </td>
                                        <td valign="top" height="100" width="100">
                                            <%#((DateTime)DataBinder.Eval(Container.DataItem,"TCreateTS")).ToString("yyyy/MM/dd")%>
                                        </td>
                                        <td width="50">
                                            <%#DataBinder.Eval(Container.DataItem,"TAuthor") %>
                                        </td>
                                        <td>
                                            <%#(DataBinder.Eval(Container.DataItem, "TMobile").ToString() == "" ? "暂无" : DataBinder.Eval(Container.DataItem, "TMobile").ToString())%>
                                        </td>
                                        <td>
                                            <%#LMSemir.Common.TEEUtil.AnaylzsisEmail(DataBinder.Eval(Container.DataItem, "TEmail").ToString())%>
                                        </td>
                                        <td>
                                            <%# LMSemir.Common.WebUtils.GetSubString(DataBinder.Eval(Container.DataItem, "TAddress").ToString(), 10) == "" ? "暂无" : LMSemir.Common.WebUtils.GetSubString(DataBinder.Eval(Container.DataItem, "TAddress").ToString(), 10)%>
                                        </td>
                                        <td>
                                            <a target="_blank" href="<%#DataBinder.Eval(Container.DataItem,"TLargeImage")%>">
                                                <img width="120" height="80" src="<%#DataBinder.Eval(Container.DataItem,"TLargeImage")%>"
                                                    alt="" /></a><br />
                                            <%#DataBinder.Eval(Container.DataItem,"TVideo").ToString().IndexOf("v.swf")!=-1
                                            ?"<a target=\"_blank\" href="+DataBinder.Eval(Container.DataItem,"TVideo")+">查看视频</a>"
                                            :""%>
                                        </td>
                                        <td>
                                            <input type="hidden" value="<%#DataBinder.Eval(Container.DataItem,"tstatus") %>"
                                                rel="<%#DataBinder.Eval(Container.DataItem,"tid") %>" />
                                            <input type="hidden" value="<%#DataBinder.Eval(Container.DataItem,"tfashion") %>"
                                                rel="<%#DataBinder.Eval(Container.DataItem,"tid") %>" />
                                            <input type="hidden" value="<%#DataBinder.Eval(Container.DataItem,"tjoin") %>" rel="<%#DataBinder.Eval(Container.DataItem,"tid") %>" />




                                            <input type="checkbox" value="<%#DataBinder.Eval(Container.DataItem,"tid") %>" rel="4" />
                                        </td>
                                        <td>
                                            <input type="checkbox" value="<%#DataBinder.Eval(Container.DataItem,"tid") %>" rel="3" />
                                        </td>
                                        <td>
                                            <input type="checkbox" value="<%#DataBinder.Eval(Container.DataItem,"tid") %>" rel="2" />
                                        </td>
                                        <td>
                                            <input type="checkbox" value="<%#DataBinder.Eval(Container.DataItem,"tid") %>" rel="1" />
                                        </td>
                                        <td>
                                            <input type="text" style="width: 30px;" value="<%#DataBinder.Eval(Container.DataItem,"tavotecount")%>"
                                                id="ta_<%#DataBinder.Eval(Container.DataItem,"tid") %>" />
                                            <a href="javascript:void(0);" onclick="setVoteCount('<%#DataBinder.Eval(Container.DataItem,"tid") %>');">
                                                修改</a>
                                        </td>
                                        <td>
                                            <a href="javascript:void(0)" onclick="del('<%#DataBinder.Eval(Container.DataItem,"tid") %>')">
                                                删除</a>
                                        </td>
                                    </tr>
                                </tbody>
                            </ItemTemplate>
                            <FooterTemplate>
                                <tfoot>
                                    <tr>
                                        <td colspan="6">
                                            <div>
                                                <div class="bulk-actions align-left">
                                                    <select id="sl_setCategory">
                                                        <option value="0" selected="selected">批量设置分类</option>
                                                        <option value="2">视频类</option>
                                                        <option value="3">原创类</option>
                                                        <option value="4">艺术家类</option>
                                                        <option value="5">名人类</option>
                                                    </select>
                                                    <input type="button" class="button" id="setCate" value="设置分类" />
                                                </div>
                                            </div>
                                            <div class="clear">
                                            </div>
                                        </td>
                                        <td colspan="10">
                                            <div class="scott">
                                                <%=this.strPaging%>
                                            </div>
                                        </td>
                                    </tr>
                                </tfoot>
                                </table>
                            </FooterTemplate>
                        </asp:Repeater>
                    </div>
                </div>
            </div>
            </form>
            <div class="clear">
            </div>
            <div id="footer">
                <small>&#169; Copyright 2011| Powered by <a href="#">森马TEE后台管理系统v1.0</a> | <a href="http://jasonwei.com">
                    JW</a> </small>
            </div>
        </div>
    </div>
    <script type="text/javascript" src="Scripts/jquery-1.4.1.min.js"></script>
    <script type="text/javascript" src="Scripts/facebox.js"></script>
    <script type="text/javascript" src="Scripts/lmsemir.common.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            //修改投票数

            $("#btn_export_excel").click(function () {
                var tm = $("#in_mobile").val();
                var ta = $("#in_author").val();
                var source = $("#sl_source").val();
                var status = $("#sl_status").val();
                var category = $("#sl_category").val();
                var startTS = $("#startTS").val();
                var endTS = $("#endTS").val();
                window.location.href = "category.aspx?op=export&page=1&ps=10000&ta=" + encodeURIComponent(ta) + "&tm=" + encodeURIComponent(tm) + "&source=" + encodeURIComponent(source) + "&st=" + encodeURIComponent(status) + "&cate=" + encodeURIComponent(category) + "&startts=" + encodeURIComponent(startTS) + "&endts=" + encodeURIComponent(endTS) + "";
            })

            $("input[type='hidden']").each(function () {
                var relID = $(this).attr('rel');
                var teeST = $(this).val();

                //审核绑定
                $("input[rel='4']").each(function () {
                    var ck_4_rel = $(this).attr('rel');
                    var ck_4_Value = $(this).val();

                    if (relID == ck_4_Value && teeST == ck_4_rel) {
                        $(this).attr('checked', 'checked');
                    }
                });
                //获奖绑定
                $("input[rel='3']").each(function () {

                    var ck_3_rel = $(this).attr('rel');
                    var ck_3_Value = $(this).val();
                    if (relID == ck_3_Value && teeST == ck_3_rel) {
                        $(this).attr('checked', 'checked');
                    }
                });
                //最潮绑定
                $("input[rel='2']").each(function () {

                    var ck_2_rel = $(this).attr('rel');
                    var ck_2_Value = $(this).val();

                    if (relID == ck_2_Value && teeST == ck_2_rel) {
                        $(this).attr('checked', 'checked');
                        return false;
                    }
                });
                //入围绑定
                $("input[rel='1']").each(function () {
                    var ck_1_rel = $(this).attr('rel');
                    var ck_1_Value = $(this).val();

                    if (relID == ck_1_Value && teeST == ck_1_rel) {
                        $(this).attr('checked', 'checked');
                    }
                });
            });
        });
        //修改投票数
        function setVoteCount(tid) {
            if (tid != "") {
                $.ajax({
                    type: 'get',
                    dataType: 'text',
                    url: 'Ajax/AjaxHandler.ashx',
                    data: 'm=updatevotecount&tid=' + encodeURIComponent(tid)
                    + '&i=' + Math.random()
                    + '&votecount=' + $("#ta_" + tid + "").val() + '',
                    success: function (data) {
                        if (null != data && data.length != 0 && data == 'y') {
                            alert('投票数修改成功!');
                            return false;
                        }
                    }
                });
            }
        }
        function del(obj) {
            if (obj != "") {
                $.ajax({
                    type: 'get',
                    dataType: 'text',
                    url: 'Ajax/AjaxHandler.ashx',
                    data: 'm=setteestatus&tid=' + encodeURIComponent(obj) + '&type=deltee&i=' + Math.random() + '',
                    success: function (data) {
                        if (null != data && data.length != 0 && data == 'y') {
                            alert('作品删除成功!');
                            $("#row_" + obj + "").html("");
                        }
                    }
                });

            }
        }
        $(document).ready(function () {
            //审核操作
            $("input[rel='4']").click(function () {
                var checkbox = $(this);
                var teeType = checkbox.attr("rel");
                var teeID = checkbox.val();
                //begin logic check
                if (teeType != "" && teeID != "") {
                    if (!checkbox.attr('checked')) {
                        if (confirm('您确定要取消该作品审核么？')) {
                            teeType = "cancelsetverify";
                        }
                        else {
                            return false;
                        }
                    }
                    else {
                        if (confirm("您确认该作品审核通过？")) {
                            teeType = "setverify";
                        }
                        else {
                            return false;
                        }
                    }
                    //调用ajax方法
                    $.ajax({
                        type: 'get',
                        dataType: 'text',
                        url: 'Ajax/AjaxHandler.ashx',
                        data: 'm=setteestatus&tid=' + encodeURIComponent(teeID) + '&type=' + teeType + '&i=' + Math.random() + '',
                        success: function (data) {
                            if (null != data && data.length != 0 && data == 'y') {
                                return true;
                            }
                            else {
                                alert('操作失败,数据异常'); return false;
                            }
                        }
                    });
                }

            });
            //获奖操作
            $("input[rel='3']").click(function () {
                var checkbox = $(this);
                var teeType = checkbox.attr("rel");
                var teeID = checkbox.val();

                //begin logic check
                if (teeType != "" && teeID != "") {
                    if (!checkbox.attr('checked')) {
                        if (confirm('您确定要取消该作品获奖么？')) {
                            teeType = "cancelwin";
                        }
                        else {
                            return false;
                        }
                    }
                    else {
                        if (confirm("您确认该作品获奖？")) {
                            teeType = "setwin";
                        }
                        else {
                            return false;
                        }
                    }
                    //调用ajax方法
                    $.ajax({
                        type: 'get',
                        dataType: 'text',
                        url: 'Ajax/AjaxHandler.ashx',
                        data: 'm=setteestatus&tid=' + encodeURIComponent(teeID) + '&type=' + teeType + '&i=' + Math.random() + '',
                        success: function (data) {
                            if (null != data && data.length != 0 && data == 'y') {
                                return false;
                            }
                            else {
                                alert('操作失败,数据异常'); return false;
                            }
                        }
                    });
                }
            });
            //最潮操作
            $("input[rel='2']").click(function () {
                var checkbox = $(this);
                var teeType = checkbox.attr("rel");
                var teeID = checkbox.val();


                //begin logic check
                if (teeType != "" && teeID != "") {
                    if (!checkbox.attr('checked')) {
                        if (confirm('您确定要取消该最潮作品么？')) {
                            teeType = "canceltop6";
                        }
                        else {
                            return false;
                        }
                    }
                    else {
                        if (confirm("您确认该作品是最潮的？")) {
                            teeType = "settop6";
                        }
                        else {
                            return false;
                        }
                    }
                    //调用ajax方法
                    $.ajax({
                        type: 'get',
                        dataType: 'text',
                        url: 'Ajax/AjaxHandler.ashx',
                        data: 'm=setteestatus&tid=' + encodeURIComponent(teeID) + '&type=' + teeType + '&i=' + Math.random() + '',
                        success: function (data) {
                            if (null != data && data.length != 0 && data == 'y') {
                                return false;
                            }
                            else {
                                alert('操作失败,数据异常'); return false;
                            }
                        }
                    });
                }
            });
            //入围操作
            $("input[rel='1']").click(function () {
                var checkbox = $(this);
                var teeType = checkbox.attr("rel");
                var teeID = checkbox.val();

                //begin logic check
                if (teeType != "" && teeID != "") {
                    if (!checkbox.attr('checked')) {
                        if (confirm('您确定要取消该入围作品么？')) {
                            teeType = "canceltop20";
                        }
                        else {
                            return false;
                        }
                    }
                    else {
                        if (confirm("您确认该作品是入围的？")) {
                            teeType = "settop20";
                        }
                        else {
                            return false;
                        }
                    }
                    //调用ajax方法
                    $.ajax({
                        type: 'get',
                        dataType: 'text',
                        url: 'Ajax/AjaxHandler.ashx',
                        data: 'm=setteestatus&tid=' + encodeURIComponent(teeID) + '&type=' + teeType + '&i=' + Math.random() + '',
                        success: function (data) {
                            if (null != data && data.length != 0 && data == 'y') {
                                return false;
                            }
                            else {
                                alert('操作失败,数据异常'); return false;
                            }
                        }
                    });
                }
            });
        });

    </script>
</body>
</html>
